import {request} from '@/utils/request';

/**
 * 授权登录
 * @param {*} data 
 * data参数包含 { code: code码, iv: '', encryptedData: '' 加密数据 }
 * @returns 
 */
export const userLogin = (data) => {
  return request('/user/login', data, 'POST')
}

/**
 * 首页banner图
 * @returns 
 */
export const getBanners = () => {
  return request('/index/homeBanner', {
    site:"xcx_banner"
  })
}

/**
 * 获取排行榜数据
 * @returns 
 */
export const getRankList = () => {
  return request('/video/hotList');
}

/**
 * 影视分类
 * @param {*} data 
 * @returns 
 */
export const getCategories = (params = {}) => {
  return request('/video/videoType', params);
}

/**
 * 分类详情
 * @param {*} id 
 * @returns 
 */
export const getCategoryDetail = (id) => {
  return request(`/video/videoTypeInfo?id=${id}`);
}

/**
 * 影视列表
 * @param Object params
 * categories => 栏目id  page => 当前页
 * @returns 
 */
export const getVideoList = (params = {}) => {
  return request('/video/videoList', params)
}

/**
 * 推荐视频
 * @param {*} params 
 * @returns 
 */
export const getRecommendList = (params = {}) => {
  return request('/video/recommendList', params);
}

/**
 * 视频详情
 * @param {*} id 视频id
 * @returns 
 */
export const getVideoDetail = (id) => {
  return request(`/video/videoInfo?id=${id}`);
}

/**
 * 用户收藏
 * @param {*} data 
 * video_id 视频id type是否收藏 1是 2否
 * @returns 
 */
export const userCollect = (data = {}) => {
  return request('/video/getCollection', data, 'POST')
}

/**
 * 收藏列表
 * @param {*} params  page 当前页 limit 个数
 * @returns 
 */
export const getCollectList = (params = {}) => {
  return request(`/user/getCollectionList?page=${params.page}&limit=${params.limit}`);
}

/**
 * 搜索热词
 * @returns 
 */
export const getHotSearchKeywords = () => {
  return request('/video/hotSearch');
}

/**
 * 政策隐私
 * @returns 
 */
export const getPrivacy = () => {
  return request('/index/privacy')
}

/**
 * 用户反馈
 * @param {*} data 
 * @returns 
 */
export const feedback = (data = {}) => {
  return request('/video/feedback', data, 'POST')
}